package com.fortune.rainshine.controller;

import com.fortune.rainshine.feign.service.ShopFeign;
import com.fortune.rainshinecommon.base.MsgModel;
import com.fortune.rainshinecommon.base.ParmsModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: rainShine
 * @description: 业务记录明细接口
 * @author: tangyn
 * @create: 2019-06-24
 **/
@RestController
@RequestMapping("serviceRecordController")
public class ServiceRecordController {
    @Autowired
    private ShopFeign shopFeign;

    @ResponseBody
    @RequestMapping("/shopList")
    public MsgModel shopList(@RequestBody ParmsModel parm){
        ServletRequestAttributes attributes=(ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request=attributes.getRequest();
        String userId = request.getHeader("userId");
        parm.setUserId(Integer.valueOf(userId));
        return shopFeign.getServiceRecordShops(parm);
    }
}
